<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>成绩管理系统</title>
    <link rel="stylesheet" href="{{url_for('static',filename='home.css')}}">
</head>
<body>
    <header>
        <h1>成绩管理系统</h1>
        <div id="user_info">用户: {{username}} ({{user_type}})</div>
        <a href="{{url_for('logout')}}">退出</a>
    </header>
    <main>
        <section id="options" style="display: flex;justify-content: center;align-items: center;">
            <button id="add_score_option" class="option">添加学生成绩</button>
            <button id="add_course_option" class="option">添加课程信息</button>
        </section>
        <section id="student_info">
        <table>
            <thead>
                <tr>
                    <th>学号</th>
                    <th>姓名</th>
                </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
        </section>
        <section id="course_info">
        <table>
            <thead>
                <tr>
                    <th>课程号</th>
                    <th>课程名</th>
                </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
        </section>
        <section id="add_score_section">
            <h2 id="formTitle" style="text-align: center;">添加成绩</h2>
            <form id="add_score_form">
                <label for="name">姓名:</label>
                <input type="text" id="name" name="name" required>
                <label for="course">课程:</label>
                <input type="text" id="course_for_score" name="course" required>
                <label for="score">成绩:</label>
                <input type="number" id="score" name="score" required>
                <button type="submit" id="submit_score">添加</button>
            </form>
        </section>
        <section>
            <h2 style="text-align: center;">学生成绩列表</h2>
            <form id="score_form" action="/get_score_info" method="post">
                <table id="score_table">
                    <thead>
                        <tr>
                            <th>姓名</th>
                            <th>课程</th>
                            <th>成绩</th>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
                <button type="submit" id='commit_score' style="width: 100%;">提交</button>
            </form>
            <div id="score_container" style="display:none;">
                <iframe id="score_iframe" name="score_iframe" style="width:100%; height:50px;"></iframe>
            </div>
        </section>
        <section id="add_course_section">
            <h2 id="formTitle" style="text-align: center;">添加课程信息</h2>
            <form id="add_course_form">
                <label for="course">课程:</label>
                <input type="text" id="course_for_add" name="course" required>
                <button type="submit" id="submit_course">添加</button>
            </form>
        </section>
        <section>
            <h2 style="text-align: center;">课程信息列表</h2>
            <form id="course_form" action="/get_course_info" method="post">
                <table id="course_table">
                <thead>
                    <tr>
                    <th>课程</th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
                </table>
                <button type="submit" id='commit_course' style="width: 100%;">提交</button>
            </form>
            <div id="course_container" style="display:none;">
                <iframe id="course_iframe" name="course_iframe" style="width:100%; height:50px;"></iframe>
            </div>
        </section>
    </main>
    <script src="{{url_for('static',filename='home.js')}}"></script>
</body>
</html>
